<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>老师列表</title>
    <script th:src="@{/js/jquery.min.js}"></script>
    <style>
        table {
            border-color: #000000;
            border-collapse: collapse; /*设置单元格的边框合并为1*/
            width: 50%;
            text-align: center;
        }

        td {
            border-color: #000000;
        }

        th {
            background: #F4F4F4;
        }

        table tr:nth-child(odd) {
            background: #FFFFFF;
        }

        table tr:nth-child(even) {
            background: #F4F4F4;
        }
    </style>
    <script type="text/javascript">
        function delData(id) {
            $.ajax({
                type: "GET",
                url: "/teacher/deleteData",
                data: "id=" + id,
                success: function (resp) {
                    window.location.reload()
                },
            });
        }
    </script>
</head>
<body>
<h1>老师信息管理</h1>
<table border="1">
    <thead>
    <th>序号</th>
    <th>编号</th>
    <th>姓名</th>
    <th>操作</th>
    </thead>
    <tbody>
    <tr th:each="teacher:${session.teacherList}">
        <td th:text="${teacher.id}"></td>
        <td th:text="${teacher.teacherNo}"></td>
        <td th:text="${teacher.name}"></td>
        <td><input type="button" th:onclick="delData([[${teacher.id}]])" value="删除" /></td>
    </tr>
    </tbody>
</table>
<br>
<a style="margin-top:100px;border: black 1px solid;" href="/teacher/add">添加老师信息</a>
<a style="margin-top:100px;border: black 1px solid;" href="/index">返回首页</a>
</body>
</html>